package com.org.javabody.lambda.Runnable;

/**
 * Lambda function
 * Created by Administrator on 2017-01-18.
 */
public class LambdaDemo {
    //jdk1.8之前runnable的用法
    public static void beforeJdk8() {
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("Before Java8 ");
            }
        }).start();
    }
    //使用lambda表达式
    public static void afterJdk8() {
        //Java 8 way:
        new Thread( () -> System.out.println("In Java8!") ).start();
    }

    public static void main(String[] args) {
        LambdaDemo.beforeJdk8();
        LambdaDemo.afterJdk8();
    }
}
